/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="dealer_level")
public class DealerLevel implements Serializable {
	public DealerLevel() {
	}
	
	private int id;
	
	private String name;
	
	private Integer level;
	
	private Double percent;
	
	private Integer joinPoint;
	
	private Integer joinMoney;
	
	private String imgUrl;
	
	private cn.imvc.app.entities.PriceClass priceClass;
	
	private Byte type;
	
	private java.util.Set dealer = new java.util.HashSet();
	
	private java.util.Set dealerApply = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_DEALERLEVEL_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_DEALERLEVEL_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 等级名称
	 */
	public void setName(String value) {
		this.name = value;
	}
	
	/**
	 * 等级名称
	 */
	@Column(name="name", nullable=true, length=255)	
	public String getName() {
		return name;
	}
	
	/**
	 * 等级高低，高级数字大，低级数字小
	 */
	public void setLevel(int value) {
		setLevel(new Integer(value));
	}
	
	/**
	 * 等级高低，高级数字大，低级数字小
	 */
	public void setLevel(Integer value) {
		this.level = value;
	}
	
	/**
	 * 等级高低，高级数字大，低级数字小
	 */
	@Column(name="level", nullable=true, length=10)	
	public Integer getLevel() {
		return level;
	}
	
	/**
	 * 分佣等级
	 */
	public void setPercent(double value) {
		setPercent(new Double(value));
	}
	
	/**
	 * 分佣等级
	 */
	public void setPercent(Double value) {
		this.percent = value;
	}
	
	/**
	 * 分佣等级
	 */
	@Column(name="`percent`", nullable=true)	
	public Double getPercent() {
		return percent;
	}
	
	/**
	 * 加盟费用
	 */
	public void setJoinMoney(int value) {
		setJoinMoney(new Integer(value));
	}
	
	/**
	 * 加盟费用
	 */
	public void setJoinMoney(Integer value) {
		this.joinMoney = value;
	}
	
	/**
	 * 加盟费用
	 */
	@Column(name="joinMoney", nullable=true, length=10)	
	public Integer getJoinMoney() {
		return joinMoney;
	}
	
	/**
	 * 等级图标
	 */
	public void setImgUrl(String value) {
		this.imgUrl = value;
	}
	
	/**
	 * 等级图标
	 */
	@Column(name="imgUrl", nullable=true, length=255)	
	public String getImgUrl() {
		return imgUrl;
	}
	
	public void setJoinPoint(int value) {
		setJoinPoint(new Integer(value));
	}
	
	public void setJoinPoint(Integer value) {
		this.joinPoint = value;
	}
	
	@Column(name="joinPoint", nullable=true, length=10)	
	public Integer getJoinPoint() {
		return joinPoint;
	}
	
	public void setType(byte value) {
		setType(new Byte(value));
	}
	
	public void setType(Byte value) {
		this.type = value;
	}
	
	@Column(name="type", nullable=true)	
	public Byte getType() {
		return type;
	}
	
	public void setPriceClass(cn.imvc.app.entities.PriceClass value) {
		this.priceClass = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.PriceClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="priceClassId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.PriceClass getPriceClass() {
		return priceClass;
	}
	
	public void setDealer(java.util.Set value) {
		this.dealer = value;
	}
	
	@OneToMany(mappedBy="dealerLevel", targetEntity=cn.imvc.app.entities.Dealer.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getDealer() {
		return dealer;
	}
	
	
	public void setDealerApply(java.util.Set value) {
		this.dealerApply = value;
	}
	
	@OneToMany(mappedBy="dealerLevel", targetEntity=cn.imvc.app.entities.DealerApply.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getDealerApply() {
		return dealerApply;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("DealerLevel[ ");
			sb.append("Id=").append(getId()).append(" ");
			sb.append("Name=").append(getName()).append(" ");
			sb.append("Level=").append(getLevel()).append(" ");
			sb.append("Percent=").append(getPercent()).append(" ");
			sb.append("JoinPoint=").append(getJoinPoint()).append(" ");
			sb.append("JoinMoney=").append(getJoinMoney()).append(" ");
			sb.append("ImgUrl=").append(getImgUrl()).append(" ");
			if (getPriceClass() != null)
				sb.append("PriceClass.Persist_ID=").append(getPriceClass().toString(true)).append(" ");
			else
				sb.append("PriceClass=null ");
			sb.append("Type=").append(getType()).append(" ");
			sb.append("Dealer.size=").append(getDealer().size()).append(" ");
			sb.append("DealerApply.size=").append(getDealerApply().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
